/*
 * LembarInformasiView.java
 *
 * Created on September 9, 2008, 5:40 AM
 */
package com.indragunawan.restobiz.app;

import java.awt.event.KeyEvent;
import org.jdesktop.application.Action;

/**
 *
 * @author  igoens
 */
public class LembarInformasiView extends javax.swing.JDialog {

    private static final long serialVersionUID = -2904597037431147013L;

    /** Creates new form LembarInformasiView */
    public LembarInformasiView(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        informasiTextPane.setCaretPosition(0);
        getRootPane().setDefaultButton(tutupButton);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        informasiScrollPane = new javax.swing.JScrollPane();
        informasiTextPane = new javax.swing.JTextPane();
        tutupButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.indragunawan.restobiz.app.MainApp.class).getContext().getResourceMap(LembarInformasiView.class);
        setTitle(resourceMap.getString("lembarInformasi.title")); // NOI18N
        setName("lembarInformasi"); // NOI18N

        informasiScrollPane.setName("informasiScrollPane"); // NOI18N

        informasiTextPane.setBackground(resourceMap.getColor("informasiTextPane.background")); // NOI18N
        informasiTextPane.setContentType(resourceMap.getString("informasiTextPane.contentType")); // NOI18N
        informasiTextPane.setEditable(false);
        informasiTextPane.setText(resourceMap.getString("informasiTextPane.text")); // NOI18N
        informasiTextPane.setName("informasiTextPane"); // NOI18N
        informasiScrollPane.setViewportView(informasiTextPane);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(com.indragunawan.restobiz.app.MainApp.class).getContext().getActionMap(LembarInformasiView.class, this);
        tutupButton.setAction(actionMap.get("closeInformasi")); // NOI18N
        tutupButton.setMnemonic('T');
        tutupButton.setText(resourceMap.getString("tutupButton.text")); // NOI18N
        tutupButton.setName("tutupButton"); // NOI18N
        tutupButton.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tutupButtonKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(informasiScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 583, Short.MAX_VALUE)
                    .addComponent(tutupButton))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(informasiScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tutupButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void tutupButtonKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tutupButtonKeyPressed
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        closeInformasi();
    }
}//GEN-LAST:event_tutupButtonKeyPressed

    @Action
    public void closeInformasi() {
        this.dispose();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane informasiScrollPane;
    private javax.swing.JTextPane informasiTextPane;
    private javax.swing.JButton tutupButton;
    // End of variables declaration//GEN-END:variables
}
